From 0c436789a443a2adb5049c5351ab43eaa74d30b9 Mon Sep 17 00:00:00 2001 From: Nathanael Jones Date: Tue, 7 Feb 2017 19:05:10 -0700 Subject: [PATCH] Add test fresh_builds_possible_with_link_libs --- tests/build-script.rs | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/build-script.rs b/tests/build-script.rs index d0179e68a..5f4dee764 100644 --- a/tests/build-script.rs +++ b/tests/build-script.rs @@ -1781,6 +1781,46 @@ fn changing_an_override_invalidates() { ")); } + +#[test] +fn fresh_builds_possible_with_link_libs() { + // The bug is non-deterministic. Sometimes you can get a fresh build + let target = rustc_host(); + let p = project("foo") + .file("Cargo.toml", r#" + [project] + name = "foo" + version = "0.5.0" + authors = [] + links = "nativefoo" + build = "build.rs" + "#) + .file("src/lib.rs", "") + .file(".cargo/config", &format!(" + [target.{}.nativefoo] + rustc-link-lib = [\"a\"] + rustc-link-search = [\"./b\"] + rustc-flags = \"-l z -L ./\" + ", target)) + .file("build.rs", ""); + + assert_that(p.cargo_process("build").arg("-v"), + execs().with_status(0).with_stderr("\ +[COMPILING] foo v0.5.0 ([..] +[RUNNING] `rustc [..]` +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] +")); + + assert_that(p.cargo("build") + .arg("-v") + .env("RUST_LOG", "cargo::ops::cargo_rustc::fingerprint=info"), + execs().with_status(0).with_stderr("\ +[FRESH] foo v0.5.0 ([..]) +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] +")); +} + + #[test] fn fresh_builds_possible_with_multiple_metadata_overrides() { // The bug is non-deterministic. Sometimes you can get a fresh build -- 2.30.2